package dr.request.admin.action;

import javax.servlet.http.*;

import dr.controller.*;
import dr.request.dao.RequestDAO;
import dr.request.domain.Request;

public class RequestWriteProAction extends ActionSupportLogin{
	
	public String execute(HttpServletRequest request, 
			HttpServletResponse response) throws Throwable{
		

		String id=getUserLoginId(request);// session
		
		//login check
		if(id==null){
			return "/member/loginForm.jsp";
		}
		//login check
		
		request.setCharacterEncoding("euc-kr");
		Request req = new Request();
		req.setNum(Integer.parseInt(request.getParameter("num")));
		//sessionId로 값 넘겨주기
		req.setId(id);
		req.setSubject(request.getParameter("subject"));
		req.setContent(request.getParameter("content"));
		req.setRef(Integer.parseInt(request.getParameter("ref")));
		req.setRe_step(Integer.parseInt(request.getParameter("re_step")));
		req.setRe_level(Integer.parseInt(request.getParameter("re_level")));
		req.setIp(request.getRemoteAddr()); // 작성자 ip주소값
		
		
		RequestDAO manager = RequestDAO.getInstance();
		manager.insertArticla(req);
		
		return "/adminRequest/writePro.jsp";
		
		
	}

}
